package cn.shengchao.examstar.shared.domain.enums;

/**
 * 知识点掌握度枚举
 * 定义在共享内核中，统一掌握度标准
 */
public enum MasteryLevel {
    MASTERED("S", "精通"),
    PROFICIENT("A", "掌握"),
    FAMILIAR("B", "理解"),
    LEARNING("C", "初步了解");
    
    private final String code;
    private final String description;
    
    MasteryLevel(String code, String description) {
        this.code = code;
        this.description = description;
    }
    
    public String getCode() {
        return code;
    }
    
    public String getDescription() {
        return description;
    }
    
    /**
     * 根据代码获取掌握度枚举
     *
     * @param code 掌握度代码
     * @return 掌握度枚举，如果未找到则返回null
     */
    public static MasteryLevel fromCode(String code) {
        if (code == null) return null;
        
        for (MasteryLevel level : values()) {
            if (level.code.equalsIgnoreCase(code)) {
                return level;
            }
        }
        return null;
    }
} 